﻿
@{
    ViewData["Title"] = "Login";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<body class="gray-bg">

    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>

                <h1 class="logo-name">H+</h1>

            </div>
            <h3>欢迎使用</h3>

            <form class="m-t" role="form" action="index.html">
                <div class="form-group">
                    <input type="text" id="UserName" class="form-control" placeholder="用户名" required="">
                </div>
                <div class="form-group">
                    <input type="password" id="pwd" class="form-control" placeholder="密码" required="">
                </div>
                <button type="button" class="btn btn-primary block full-width m-b" id="btnLogin">登 录</button>


                <p class="text-muted text-center">
                    <a href="#"><small>忘记密码了？</small></a> <!--| <a href="register.html">注册一个新账号</a>-->
                </p>

            </form>
        </div>
    </div>
</body>
<script type="text/javascript">
    $(function () {
        //防止登录信息过期导致跳转登录页卡在框架内
        if (top != window)
            top.location.href = window.location.href;
        //========================================================
        $("#btnLogin").click(function () {
            var obj = { UserName: $("#UserName").val(), PassWord: $("#pwd").val() };
            $.ajax({
                type: 'post',
                url: "@Url.Action("UserLogin", "Access")",
                data: obj,
                //dataType: 'json',
                ContentType : "application/json",
                success: function (data) {
                    if (data.requestStatus == true) {
                        window.location.href = "@Url.Action("Index","Access")";
                    }
                    //var newJson = eval(data)
                    //if (newJson.requestStatus==true) {
                    //    window.location.href = newJson.resultData.url;
                    //}
                }
            });
        })
    })
      
</script>
